<template>
  <el-tree-select v-model="name" :data="data" :render-after-expand="false" :props="defaultProps" :multiple="props.multiple==1" />
</template>

<script setup lang="ts">
import { computed, onMounted } from "vue";
const { proxy } = getCurrentInstance();
let props = defineProps(["modelValue", "val", "multiple"]);
const emit = defineEmits(["update:modelValue", "fatherMethods"]);
let data = ref([]);

onMounted(() => {
  getInfo();
});
const name = computed({
  get() {
    return props.modelValue;
  },
  set(value: Number) {
    emit("update:modelValue", value);
  },
});
let defaultProps = computed(() => {
  return {
    label: "name",
    value: "id",
  };
});

let getInfo = async () => {
  let resp = await proxy.$apis.workTypeList({});
  data.value = proxy.$utils.transformArray(resp, "id", "pid");
};
</script>

<style lang="scss" scoped>
</style>
